'''
Created on Mar 3, 2012

@author: kafkef
'''

from PyQt4.QtCore import Qt, SIGNAL
from PyQt4.QtGui import *

class TableView(QTableView):
    def __init__(self):
        QTableView.__init__(self)
        self.setSelectionBehavior(QAbstractItemView.SelectRows)
        # Configure header
        header = self.horizontalHeader()
        assert isinstance(header, QHeaderView)
        header.setDefaultAlignment(Qt.AlignLeft)
        header.setStretchLastSection(True)
        #QWidget.connect(self, SIGNAL("doubleClicked(const QModelIndex&)"),
        #                self.on_double_click)
        self.setSortingEnabled(True)
        self.setShowGrid(True)
    
    #def mouseDoubleClickEvent(self, event):
    #    print "Heelooo double cliccccccccccccked!"
    
    def on_double_click(self):
        print "On double click, HAAHHAHAHHA"    
